<script>
import QrCodeView from '@comp/qrcode/QrCodeView.vue'

export default {
  name: 'EntryLabel',
  components: { QrCodeView },
  props: {
    materialCode: String,
    materialName: String,
    specificationModel: String,
    batchNumber: String,
    materialBatchNumber: String,
    quantity: [String, Number],
    entryNumber: String
  }
}
</script>

<template>
  <div class="entry-label-container">
    <div class="qr-code">
      <qr-code-view
        v-if="batchNumber"
        :qr-code-text="batchNumber"
        :qr-code-size="130" />
      <div class="batch-number">
        <div>{{ batchNumber }}</div>
      </div>
    </div>
    <div class="info">
      <div class="info-item">
        <div class="info-item-label">入库单号：</div>
        <div class="info-item-value">{{ entryNumber }}</div>
      </div>
      <div class="info-item">
        <div class="info-item-label">物料编码：</div>
        <div class="info-item-value">{{ materialCode }}</div>
      </div>
      <div class="info-item">
        <div class="info-item-label">物料名称：</div>
        <div class="info-item-value">{{ materialName }}</div>
      </div>
      <div class="info-item">
        <div class="info-item-label">规格型号：</div>
        <div class="info-item-value">{{ specificationModel }}</div>
      </div>
      <div class="info-item">
        <div class="info-item-label">物料批号：</div>
        <div class="info-item-value">{{ materialBatchNumber }}</div>
      </div>
      <div class="info-item">
        <div class="info-item-label">数量：</div>
        <div class="info-item-value">{{ quantity }}</div>
      </div>
    </div>
  </div>
</template>

<style scoped lang="less">
.entry-label-container {
  display: flex;
  border: 1px solid #ccc;
  padding: 10px;
  margin: 10px;
  width: 350px;

  .qr-code {
    margin-right: 20px;
  }

  .batch-number {
    text-align: center;
    margin: 5px 0 0;
  }

  .info {
    flex: 1;
  }

  .info-item {
    display: flex;
    margin: 5px 0;

    .info-item-label {
      font-weight: bold;
    }
  }

}
</style>